<?php

namespace App\Model;

use Illuminate\Database\Eloquent\Model;
use DB;

class WarehouseOrder extends Model
{
    protected $table = 'warehousing_order';
    public static function getorders($id){
        /*$count = 11-mb_strlen($id);
        $j=9;
        $h=1;
        for ($i=2;$i<=$count;$i++){
            $c = 9;
            $hh = 1;
            $j = $j.$c;
            $h = $h.$hh;
        }
        return 'RK'.mt_rand($h,$j).$id;*/
        return 'RK'.time().mt_rand(1111,9999);
    }
    //入库单详情
    public function warehouseMaterials()
    {
        return $this->hasMany('App\Model\WarehouseMaterials','order_id');
    }
    //申请人
    public function Users()
    {
        return $this->belongsTo('App\Model\Users','user_id');
    }
}
